package com.newland.esp.controller.user;

import com.newland.esp.common.util.DataResult;
import com.newland.esp.entity.user.UserEntity;
import com.newland.esp.service.user.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @param
 * @author lw
 * @descripe
 * @date 2021/8/13 23:10
 * @Version 1.0
 **/
@Controller
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping("/user/star/{id}")
    @ResponseBody
    public DataResult getStarById(@PathVariable("id") String id){
        DataResult star = userService.getStarById(id);
        return star;
    }

    @RequestMapping("/user/starAdd")
    @ResponseBody
    public DataResult addStar(@RequestBody UserEntity userEntity){
        DataResult result = userService.addUser(userEntity);
        return result;
    }

}
